

// Styles targeted at story content
@import './_content.scss';

.is-group-reader.has-no-sidebar {
	.masterbar {
		@include breakpoint( '<660px' ) {
			display: none; // Hides masterbar in fullpost mobile
		}
	}
}

.reader-full-post.main {
	max-width: none;
	// Turns off the implicit positioning context set up by the normal main styles
	// This allows our fixed positioned elements to be positioned relative to the main html document
	backface-visibility: visible;
	perspective: none;
}

.reader-full-post__content {
	margin: 0 auto;

	@include breakpoint( '>1280px' ) {
		width: 720px;
		padding-left: 260px;
	}

	@include breakpoint( '1040px-1280px' ) {
		width: 720px;
		padding-left: 240px;
	}

	@include breakpoint( '660px-1040px' ) {
		width: auto;
		margin: 0;
		padding-left: 240px;
	}

	@include breakpoint( '<660px' ) {
		width: auto;
		padding: 0 20px;
	}
}

.reader-full-post__visit-site-container {
	background: var( --color-surface );
	border-bottom: 1px solid var( --color-neutral-0 );
	font-size: 11px;
	font-weight: 500;
	height: 46px;
	margin: 0;
	position: fixed;
	right: 0;
	top: 0;
	text-transform: uppercase;
	z-index: z-index(
		'.reader-full-post__sidebar-comment-like',
		'.reader-full-post__visit-site-container'
	);

	@include breakpoint( '>660px' ) {
		border: 0;
		position: absolute;
		top: 47px;
		z-index: 0;
	}

	.external-link .gridicons-external {
		fill: var( --color-neutral-40 );
		top: 5px;

		@include breakpoint( '>660px' ) {
			top: 3px;
		}
	}

	.external-link {
		color: var( --color-neutral-40 );
		display: block;
		padding: 10px 10px 15px 6px;

		@include breakpoint( '>660px' ) {
			padding: 10px 20px 15px;
		}

		&:hover {
			color: var( --color-accent );

			.gridicons-external {
				fill: var( --color-accent );
			}
		}
	}

	.reader-full-post__visit-site-label {
		@include breakpoint( '<660px' ) {
			display: none;
		}
	}
}

.reader-full-post__sidebar {
	width: 220px;
	position: fixed;
	text-align: center;

	@include breakpoint( '>1280px' ) {
		left: calc( 50% - 490px );
	}

	@include breakpoint( '1040px-1280px' ) {
		left: calc( 50% - 480px );
	}

	@include breakpoint( '660px-1040px' ) {
		left: 20px;
	}

	@include breakpoint( '<660px' ) {
		position: static;
		text-align: left;
		width: auto;
	}
}

.reader-full-post__story {
	max-width: 720px;

	@include breakpoint( '<480px' ) {
		font-size: 15px;
		line-height: 24px;
	}

	@include breakpoint( '<660px' ) {
		margin-top: -35px;
	}
}

.reader-full-post__story-content {
	color: var( --color-neutral-70 );
	font-size: 17px;
	line-height: 28px;
}

.reader-full-post__story-content img {
	margin-bottom: 12px;

	&.latex {
		margin-bottom: 0;
	}
}

.reader-full-post__story-content figure img {
	margin-bottom: 0;
}

.reader-full-post .back-button {
	@include breakpoint( '<660px' ) {
		background: transparent;
		border-bottom: 0;
		position: fixed;
		width: 100px;
		z-index: z-index( '.reader-full-post__sidebar-comment-like', '.reader-full-post .back-button' );
	}
}

.reader-full-post .author-compact-profile {
	display: inline-flex;
	flex-direction: column;

	@include breakpoint( '<660px' ) {
		margin-bottom: 35px;
		padding-right: 10px;
		position: relative;
		text-overflow: clip;
		white-space: nowrap;

		&::after {
			height: 40px;
		}

		&:not( .is-placeholder )::after {
			@include long-content-fade( $size: 15% );
		}
	}

	.reader-author-link {
		margin-top: 0;
	}

	@include breakpoint( '<660px' ) {
		flex-direction: row;
		margin-top: 20px;

		.reader-avatar {
			flex: 1;
			margin: 0 0 0 -9px;

			&.has-site-and-author-icon,
			&.has-site-icon,
			&.has-gravatar {
				margin: 0 10px 5px 0;
			}

			&.has-gravatar {
				.gravatar {
					height: 32px !important;
					width: 32px !important;
					max-width: none;
				}
			}

			&.has-site-and-author-icon.has-site-icon.has-gravatar {
				margin-bottom: -15px;

				.gravatar {
					height: 24px !important;
					margin-right: 1em;
					position: relative;
					left: 18px;
					top: -18px;
					vertical-align: bottom;
					width: 24px !important;
				}
			}

			.site-icon {
				height: 32px !important;
				width: 32px !important;
				line-height: 32px !important;
				font-size: 32px !important;

				.gridicon {
					@include breakpoint( '<660px' ) {
						height: 32px !important;
						width: 32px !important;
						line-height: 32px !important;
						font-size: 32px !important;
					}
				}
			}
		}

		.reader-author-link {
			font-weight: 700;
			display: inline;
			margin-right: 5px;

			&::after {
				content: ',';
				font-weight: normal;
			}
		}

		.author-compact-profile__site-link {
			flex: 1 0 0;
			display: inline;

			@include breakpoint( '<660px' ) {
				margin-top: 0;
			}
		}

		.reader-author-link,
		.author-compact-profile__site-link {
			padding-top: 5px;
		}

		.author-compact-profile__follow .follow-button {
			position: fixed;
			left: calc( 100% - 270px );
			top: 5px;

			@include breakpoint( '<660px' ) {
				background: transparent;
				position: fixed;
				z-index: z-index(
					'.reader-full-post__sidebar-comment-like',
					'.author-compact-profile__follow .follow-button'
				);

				.gridicon {
					height: 24px;
					top: 7px;
					width: 24px;
				}
			}
		}

		.author-compact-profile__follow-count {
			display: none;
		}

		.author-compact-profile__follow .follow-button__label {
			@include breakpoint( '<660px' ) {
				display: none;
			}
		}
	}
}

.reader-full-post .reader-full-post__sidebar {
	color: var( --color-text-subtle );

	a.reader-author-link,
	a.author-compact-profile__site-link {
		color: var( --color-primary );

		&:hover {
			color: var( --color-primary-light );
		}
	}
}

// Action buttons in full-post
.reader-full-post .reader-post-actions {
	clear: both;
	margin-bottom: 20px;

	.post-edit-button__label,
	.reader-share__button-label,
	.comment-button__label,
	.like-button__label {
		font-size: 17px;
	}
}

.reader-full-post .like-button .gridicon {
	top: 4px;
}

.reader-full-post__sidebar-comment-like {
	@include breakpoint( '<660px' ) {
		align-items: flex-start;
		background: white;
		display: flex;
		border-bottom: 1px solid var( --color-neutral-0 );
		flex-direction: row;
		height: 47px;
		justify-content: flex-end;
		position: fixed;
		left: 0;
		top: 0;
		width: 100%;
		z-index: z-index( 'root', '.reader-full-post__sidebar-comment-like' );
	}
}

.reader-full-post__sidebar .like-button {
	@include breakpoint( '<660px' ) {
		margin-right: 60px;
		top: 9px;
	}

	.like-button__label-status {
		display: none;
	}
}

.reader-full-post__sidebar .comment-button__label,
.reader-full-post__sidebar .like-button__label {
	font-size: 14px;
}

.reader-full-post__sidebar .comment-button {
	margin-right: 18px;

	@include breakpoint( '<660px' ) {
		top: 9px;
	}

	.comment-button__label-status {
		display: none;
	}
}

// Align meta info and post title
.reader-full-post .has-author-link .author-compact-profile__avatar-link {
	display: none;
}

.reader-full-post .has-author-link.has-author-icon {
	margin-top: 25px;

	@include breakpoint( '>660px' ) {
		margin-top: 5px;
	}

	.reader-author-link {
		margin-top: 0;
	}

	.author-compact-profile__avatar-link {
		display: block;
	}
}

.reader-full-post .has-author-link {
	margin-top: 14px;
}

.reader-full-post .has-author-link .reader-author-link {
	@include breakpoint( '>660px' ) {
		margin-top: 4px;
	}
}

// For posts without a title
.reader-full-post__header.is-missing-title {
	margin-top: 60px;

	.reader-full-post__header-meta {
		margin-bottom: 20px;
	}
}

.reader-full-post__header-title {
	clear: none;
	color: var( --color-neutral-70 );
	font-family: $serif;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	font-size: 26px;
	font-weight: 700;
	line-height: 34px;
	margin: 56px 0 0;
	max-width: 750px;

	@include breakpoint( '>960px' ) {
		font-size: 36px;
		line-height: 46px;
	}

	@include breakpoint( '480px-960px' ) {
		font-size: 32px;
		line-height: 40px;
	}

	@include breakpoint( '<660px' ) {
		margin-top: 8px;
	}

	.reader-full-post__header-title-link {
		display: block;
	}

	.reader-full-post__header-title-link,
	.reader-full-post__header-title-link:hover {
		color: var( --color-neutral-70 );
	}
}

.reader-full-post__header-meta {
	display: flex;
	flex-direction: row;
	font-size: 15px;
	max-width: 750px;
}

.reader-full-post__header-date {
	line-height: 1.6;

	@include breakpoint( '<480px' ) {
		line-height: 1.4;
	}
}

.reader-full-post__header-date-link {
	margin-right: 25px;
}

.reader-full-post__header-date-link,
.reader-full-post__header-date-link:visited {
	color: var( --color-text-subtle );

	&:hover {
		color: var( --color-primary-light );
	}
}

.reader-full-post__header-tags {
	display: inline-flex;
	flex: 1;
	width: calc( 100% - 120px );

	.gridicon {
		fill: var( --color-neutral-light );
		margin-right: 5px;
		position: relative;
		top: 4px;

		@include breakpoint( '<480px' ) {
			top: 2px;
		}
	}
}

.reader-full-post__header-tag-list {
	color: var( --color-text-subtle );
	list-style: none;
	margin: 0;
	padding: 0;
	overflow: hidden;
	white-space: nowrap;
	width: 100%;

	&::after {
		@include long-content-fade( $size: 20px );
	}
}

.reader-full-post__header-tag-list-item {
	color: var( --color-text-subtle );
	display: inline;
	margin-right: 5px;

	&::after {
		content: ',';
	}

	&:last-child {
		margin-right: 0;

		&::after {
			content: '';
		}
	}
}

.reader-full-post__header-tag-list-item-link,
.reader-full-post__header-tag-list-item-link:visited {
	color: var( --color-text-subtle );

	&:hover {
		color: var( --color-primary-light );
	}
}

.reader-full-post__header {
	margin-bottom: 23px;
}

.reader-full-post__featured-image {
	margin: 28px 0 26px;
}

.reader-full-post .embed-youtube,
.reader-full-post .embed-vimeo {
	display: block;
	margin-bottom: 25px;
	position: relative;
	padding: 25px 0 56.25%;
	// We currently have to use !important here to override the inline style on the Youtube embed
	// - see https://github.com/Automattic/wp-calypso/issues/9615
	text-align: initial !important;

	iframe {
		height: 100%;
		position: absolute;
		top: 0;
		width: 100%;
	}
}

.reader-full-post .embed-vimeo {
	margin-bottom: 0;
}

.reader-full-post__unavailable-body {
	margin-top: 2em;
}

// Placeholders
.reader-full-post__header-title,
.reader-full-post__header-date {
	&.is-placeholder {
		@include placeholder();
	}
}

.reader-full-post__header-date.is-placeholder {
	margin-top: 4px;
}

.reader-full-post__story-content-placeholder-text {
	@include placeholder();
	margin-bottom: 16px;
	min-height: 200px;
}
